/**
 *
 * @description 注册全局组件
 *
 */

import type { App } from 'vue';
import {
  Button,
  NavBar,
  ConfigProvider,
  Form,
  Field,
  CellGroup,
  Icon,
  Collapse,
  CollapseItem,
  RadioGroup,
  Radio,
  Popup,
  DatetimePicker,
  Picker
} from 'vant';
import StBlock from '/@/components/StBlock/StBlock.vue';

const components = [
  Button,
  NavBar,
  ConfigProvider,
  StBlock,
  Form,
  Field,
  CellGroup,
  Icon,
  Collapse,
  CollapseItem,
  RadioGroup,
  Radio,
  Popup,
  DatetimePicker,
  Picker,
];

const vantPlugins = {
  install: (vm: App) => {
    components.forEach((item) => {
      vm.component(item.name, item);
    });
  }
};

export default (app: App) => {
  app.use(vantPlugins);
};
